﻿<Window xmlns:my="clr-namespace:System.Windows.Controls;assembly=PresentationFramework"  x:Class="Music_Tag_Organizer.Main"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Music Tag Organizer" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Height="517.298" Width="1024" Icon="folder_explore.png">
    <Window.Resources>
        <CollectionViewSource x:Key="MasterView" />
        <CollectionViewSource x:Key="ArtistView"/>
        <Style x:Key="ActionButtonTriggers" TargetType="Button">
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="true">
                    <Setter Property = "Foreground" Value="Green"/>
                </Trigger>
            </Style.Triggers>
        </Style>
        <DataTemplate x:Key="HeaderTemplateDescending">

            <DockPanel>

                <TextBlock HorizontalAlignment="Center"

               Text="{Binding}" />

                <Path x:Name="arrow" StrokeThickness="1"

          Fill="DarkGray" Data="M 5,10 L 15,10 L 10,5" />

            </DockPanel>

        </DataTemplate>

        <DataTemplate x:Key="HeaderTemplateAscending">

            <DockPanel>

                <TextBlock HorizontalAlignment="Center"

               Text="{Binding}"/>

                <Path x:Name="arrow" StrokeThickness="1"

          Fill="DarkGray" Data="M 5,5 L 10,10 L 15,5" />

            </DockPanel>

        </DataTemplate>

    </Window.Resources>
    <Grid Name="gridMain" Opacity="1" SnapsToDevicePixels="False" ShowGridLines="False" DataContext="{Binding Source={StaticResource MasterView}}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="600*" />
            <ColumnDefinition Width="200*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="427*" />
            <RowDefinition Height="35*" />
        </Grid.RowDefinitions>
        <Menu Height="30" Margin="12,12,12,0" Name="mnuMain" VerticalAlignment="Top" Grid.ColumnSpan="2">
            <MenuItem Header="File" Name="mnuFile" Click="mnuFile_Click">
                <MenuItem Header="Open" Name="mnuFileOpen" Click="mnuFileOpen_Click" />
                <MenuItem Header="Reload" Name="mnuFileReload" Click="mnuFileReload_Click" />
            </MenuItem>
        </Menu>
        <ListView GridViewColumnHeader.Click="OnColumnHeaderClick" ItemsSource="{Binding Source={StaticResource MasterView}}" Margin="12,47,0,247" Name="lvwFiles" SelectionChanged="lvwFiles_SelectionChanged" IsSynchronizedWithCurrentItem="True">
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="Filename" DisplayMemberBinding="{Binding FileName}"/>
                    <GridViewColumn Header="Title" DisplayMemberBinding="{Binding Title}" />
                    <GridViewColumn Header="Artist" DisplayMemberBinding="{Binding ContributingArtist}" />
                    <GridViewColumn Header="Album" DisplayMemberBinding="{Binding Album}" />
                    <GridViewColumn Header="Folder" DisplayMemberBinding="{Binding Folder}" />
                </GridView>
            </ListView.View>

        </ListView>
        <StackPanel Grid.Column="1" Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Height="23" Name="butSave" Width="75" Click="butSave_Click" Margin="5">Save</Button>
            <Button Height="23" Name="butClose" Width="75" Click="butClose_Click" Margin="5">Close</Button>
        </StackPanel>

        <Grid Margin="11.78,0,0,12" Name="gridData" Grid.RowSpan="2" ShowGridLines="False" Height="272" VerticalAlignment="Bottom">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="101.101*" />
                <ColumnDefinition Width="327.5*" />
                <ColumnDefinition Width="109.262*" />
                <ColumnDefinition Width="216.345*" />
            </Grid.ColumnDefinitions>
            <StackPanel Name="stackPanel1" Margin="0,0,11.13,0" HorizontalAlignment="Stretch">
                <Label Height="25" Name="label1" Width="90" HorizontalAlignment="Right">Filename</Label>
                <Label Height="25" Name="label2" Width="90" HorizontalAlignment="Right">Type</Label>
                <Label Height="25" Name="label3" Width="90" HorizontalAlignment="Right">Title</Label>
                <Label Height="25" Name="label4" Width="90" HorizontalAlignment="Right">Artist</Label>
                <Label Height="25" Name="label5" Width="90" HorizontalAlignment="Right">Album</Label>
            </StackPanel>

            <StackPanel Grid.Column="1" Name="stackData" Margin="0.022,0,0,0">
                <TextBox Height="25" Name="txtFileName" Width="375" HorizontalAlignment="Left" Text="{Binding FileName, Mode=OneWay}"/>
                <TextBox Height="25" Name="txtType" Width="375" HorizontalAlignment="Left" Text="{Binding Path=MusicFile.MimeType , Mode=OneWay}"/>
                <TextBox Height="25" Name="txtTitle" Width="375" HorizontalAlignment="Left" Text="{Binding Title , Mode=TwoWay}"/>
                <TextBox Height="25" Name="txtArtist" Width="375" HorizontalAlignment="Left" Text="{Binding ContributingArtist, Mode=TwoWay}"/>
                <TextBox Height="25" Name="txtAlbum" Width="375" HorizontalAlignment="Left" Text="{Binding Album, Mode=TwoWay}"/>
            </StackPanel>


            <StackPanel Grid.Column="2" Margin="0.005,0,0,0" Grid.ColumnSpan="2" HorizontalAlignment="Left" Width="109.262">
                <Label Height="27" Name="label6"  VerticalAlignment="Top">Suggested Title</Label>
                <Label Height="27"  Name="label7" VerticalAlignment="Top">Suggested Artist</Label>
                <Label Height="27"  Name="label8" VerticalAlignment="Top">Suggested Album</Label>
            </StackPanel>
            <StackPanel Grid.Column="3" Name="stackSuggestions">




                <TextBox Name="txtSuggestedTitle" Height="27" Text="{Binding SuggestedTitle, Mode=OneWay}" TextChanged="txtSuggestedTitle_TextChanged" />
                <TextBox Name="txtSuggestedArtist" Height="27" Text="{Binding SuggestedArtist, Mode=OneWay}" TextChanged="txtSuggestedArtist_TextChanged" />
                <TextBox Name="txtSuggestedAlbum" Height="27" Text="{Binding SuggestedAlbum, Mode=OneWay}" TextChanged="txtSuggestedAlbum_TextChanged" />
                <StackPanel Orientation="Vertical" HorizontalAlignment="Right">
                    <Button Height="23" Name="butSwap" VerticalAlignment="Bottom" Width="120" HorizontalAlignment="Right" Click="butSwap_Click" Style="{StaticResource ActionButtonTriggers}">Swap</Button>
                    <Button Height="23" Name="butUseAll" VerticalAlignment="Bottom" Width="120" HorizontalAlignment="Right" Click="butUseAll_Click" Style="{StaticResource ActionButtonTriggers}" MouseEnter="butUseAll_MouseEnter" MouseLeave="butUseAll_MouseLeave">Use All</Button>
                    <Button Height="23" Name="butUseTitle" VerticalAlignment="Bottom" Width="120" HorizontalAlignment="Right" Click="butUseTitle_Click" Style="{StaticResource ActionButtonTriggers}" MouseEnter="butUseTitle_MouseEnter" MouseLeave="butUseAll_MouseLeave">Use Title</Button>
                    <Button Height="23" Name="butUseArtist" VerticalAlignment="Bottom" Width="120" HorizontalAlignment="Right" Click="butUseArtist_Click" Style="{StaticResource ActionButtonTriggers}" MouseEnter="butUseArtist_MouseEnter" MouseLeave="butUseAll_MouseLeave">Use Artist</Button>
                    <Button Height="23" Name="butUseAlbum" VerticalAlignment="Bottom" Width="120" HorizontalAlignment="Right" Click="butUseAlbum_Click" Style="{StaticResource ActionButtonTriggers}" MouseEnter="butUseAlbum_MouseEnter" MouseLeave="butUseAll_MouseLeave">Use Album</Button>
                    <Button Height="23" Name="butUseArtistAndTitle" VerticalAlignment="Bottom" Width="120" HorizontalAlignment="Right" Click="butUseArtistAndTitle_Click" Style="{StaticResource ActionButtonTriggers}" MouseEnter="butUseArtistAndTitle_MouseEnter" MouseLeave="butUseAll_MouseLeave">Use Artist and Title</Button>
                    <Button Height="23" Name="butCapitalizeWords" VerticalAlignment="Bottom" Width="120" HorizontalAlignment="Right" Click="butCapitalizeWords_Click" Style="{StaticResource ActionButtonTriggers}">Capitalize Words</Button>

                </StackPanel>

            </StackPanel>
        </Grid>
        <StackPanel Name="stackArtists" Grid.Column="1">
            <ListView VirtualizingStackPanel.IsVirtualizing="True" Margin="2,47,0,0" Name="lvwArtists" ItemsSource="{Binding Source={StaticResource ArtistView}}" Height="430">
                <ListView.ContextMenu>
                    <ContextMenu Name="mnuArtist">
                        <MenuItem Header="Show tracks for this artist" Name="mnuArtistShow" Click="mnuArtistShow_Click"/>
                    </ContextMenu>
                </ListView.ContextMenu>
                <ListView.View>
                    <GridView>
                        <GridViewColumn Width="150" Header="Artist"/>
                    </GridView>
                </ListView.View>
            </ListView>
            <Button Height="23" Name="butShowAll" VerticalAlignment="Bottom" Width="120" HorizontalAlignment="Right" Click="butShowAll_Click"  Style="{StaticResource ActionButtonTriggers}">Show all</Button>
            <Button Height="23" Name="butUseSelectedArtist" VerticalAlignment="Bottom" Width="120" HorizontalAlignment="Right" Click="butUseSelectedArtist_Click"  Style="{StaticResource ActionButtonTriggers}">Use selected artist</Button>
        </StackPanel>
    </Grid>

</Window>
